package com.haojin.contacs;

import javax.swing.plaf.synth.SynthSpinnerUI;

public class ArrayTest {
	public static void main(String[] args) {
		String [] arr1 = new String[5];
		int[] arr2 = new int[]{1001,1002,1003,1004};
		//错误的写法
//		int[] arr = new int[];
//		int[] arr0 = new int[3]{1,2,3};
//		int[3] arr3 = new int[];
		
		arr1[0] = "哈哈";
		arr1[1] = "喔喔";
		arr1[2] = "耶耶";
		arr1[3] = "吼吼";
		arr1[4] = "哟哟";
//		如何获取数组长度？
//		属性 length
		System.out.println(arr1.length);
		System.out.println(arr2.length);
		
		
//		遍历数组元素：
		int j = arr2.length;
		for(int i = 0;i<j;i++){
			System.out.println(arr2[i]);
		}
		
		
		 j = arr1.length;
		for(int i = 0;i<j;i++){
			System.out.println(arr1[i]);
		}
	}
}
